// createApp函数，创建对应的应用，产生应用的实例对象
import { createApp } from 'vue';

import App from './App.vue'
import router from './router'
import store from './store'

const app = createApp(App)

// app.config.globalProperties 全局挂载**************************************************
import { get, post, patch, put } from './axios/index'
app.config.globalProperties.$request = { get, post, patch, put } // 自定义添加

import api from './axios/api'
app.config.globalProperties.api = api

// import { useRoute } from "vue-router";
// const route = useRoute()
// app.config.globalProperties.$route = route

// provide_inject 全局挂载**************************************************
app.provide('provide_inject', 'provide_inject挂载全局属性')
app.provide('provide_inject_fun', () => {
    console.log('mine.js 中 provide_inject 挂载全局方法')
})


// PWA 注册 service worker
// cnpm i serve -g
// serve dist        开启本地dist目录
// if ('serviceWorker' in navigator) {
//     window.addEventListener('load', () => {
//         navigator.serviceWorker.register('/service-worker.js?v=' + Math.random()).then(registration => {
//             console.log('SW registered: ', registration);
//         }).catch(registrationError => {
//             console.log('SW registration failed: ', registrationError);
//         }); 
//     });
// }




// 创建app应用返回对应的实例对象，调用mount挂载
app.use(store).use(router).mount('#app')
